package com.wc.alorithm_blue_bridge._数学知识.进制转化.Q2095;

/**
 * @Author congege
 * @Description
 * 九进制转十进制
 * https://www.lanqiao.cn/problems/2095/learning/?page=1&first_category_id=1&sort=students_count
 * @Date Created in 2023/9/19-9:55
 */
public class Main {
    public static void main(String[] args) {
        String n = "2022";
//        System.out.println(Integer.parseInt(n, 9));
        int len = n.length();

        int ans = 0;
        int time = len - 1;
        int radix = 9;
        for(char numberChar:n.toCharArray()){
            int curNumber = numberChar - '0';
            for (int i = 0; i < time; i++) {
                curNumber*=9;
            }
            time--;
            ans+=curNumber;
        }
        System.out.println(ans);
    }
}
